<!--
 * @Author: xfworld
 * @Date: 2020-06-10 15:26:04
 * @LastEditors: xfworld
 * @LastEditTime: 2020-06-11 17:10:03
 * @Description:
-->
<template>
  <div class="scanner">
    <van-nav-bar title="B2C分货" left-text="返回" @click-left="onClickLeft"></van-nav-bar>
    <van-cell-group>
      <div v-for="(item, index) in pickList" :key="index">
        <van-cell
          :title="item.orderId + ' - ' + item.barCode + ' - ' + item.carLineNo"
          :label="item.sku + ' - ' + item.skuDesc + '-' + item.pickedQty + ' - ' + item.sortQty + ' - ' + (item.pickedQty - item.sortQty)"
        />
      </div>
    </van-cell-group>
    <van-empty v-if="pickList == ''" description="查询不到数据" />
  </div>
</template>
<script>
import {lookPdaAllOrDiffData} from "@/api/sortScan/sortScan.js";
export default {
  name: "lookAll",
  computed: {},
  watch: {
    $route: {
      handler(route) {
        const his = this;
        if (route.name === "lookDiff") {
          this.pickTaskCode = this.$route.query.pickTaskCode;
          his.searchPickTaskCodeData();
        }
      }
    },
    deep: true
  },
  created() {
    this.pickTaskCode = this.$route.query.pickTaskCode;
    this.carNo = this.$route.query.carNo;
    this.searchPickTaskCodeData();
  },
  data() {
    return {
      pickTaskCode: "",
      carNo: "",
      pickList: []
    };
  },
  methods: {
    searchPickTaskCodeData() {
      lookPdaAllOrDiffData(this.pickTaskCode, "DIFF").then(response => {
        if (response.data.status) {
          let pageData = response.data.data;
          this.pickList = pageData.sortData;
        }
      });
    },
    onClickLeft() {
      this.$router.push({
        name: "sortScan",
        query: {
          pickTaskCode: this.pickTaskCode,
          carNo: this.carNo
        }
      });
    }
  }
};
</script>

<style lang="less"></style>
